package com.android.mvp.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.mvp.R;
import com.android.mvp.base.LazyFragment;
import com.android.mvp.bean.HomeBanner;
import com.android.mvp.presenter.HomePresenter;
import com.android.mvp.presenter.contract.HomeContract;
import com.android.mvp.util.ToastShow;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * desc
 *
 * @autor 徐文龙
 * @time 2016/9/9  11:18
 */
public class FragmentMain extends LazyFragment<HomePresenter, List<HomeBanner>> implements HomeContract.View {


    @Bind(R.id.text)
    TextView mText;
    @Bind(R.id.my_content_line)
    LinearLayout mMyContentLine;



//
//    @Override
//    protected void initView(View RootView) {
//
//    }
//
//    @Override
//    protected void initToolbar() {
//
//    }
//
//
//
//
//    @Override
//    protected int getContentLayout() {
//        return R.layout.fragment_main;
//    }
//
//
//
//    @Override
//    protected void initData() {
//        MLog.v("DaLong","调用了啊");
//        showProgress();
//        showNetErrorView();
//        getPresenter().getHomeBanner();
//    }


    @Override
    protected void onCreateViewLazy(Bundle savedInstanceState) {
        super.onCreateViewLazy(savedInstanceState);
        setContentView(R.layout.fragment_main);
        ButterKnife.bind(this,getContentView());

        initLazyLoadding();//初始化加载界面
        showNetErrorView();
//        showEmptyView("哈哈哈哈哈哈");
        getPresenter().getHomeBanner();
    }

    @Override
    protected void onDestroyViewLazy() {
        super.onDestroyViewLazy();
        ButterKnife.unbind(this);
    }

    @Override
    public View getLoadingTargetView() {
        return mMyContentLine;
    }

    @Override
    public void onReload() {

        ToastShow.getInstance(getActivity()).toastShow("点击了");

        showContent();
    }

    @Override
    public HomePresenter getPresenter() {
        return new HomePresenter(getActivity(), this);
    }


    @Override
    public void showDataSuccess(List<HomeBanner> datas) {
        super.showDataSuccess(datas);
    }


}
